initialize the variable with image tag
-
hi, I have a problem with this code. if you understand this please send me the explantion. I dont understand the variable intialization. could u please tell me what it means. var openImage = "
" function getPath(url) { lastSlash = url.lastIndexOf("/") return url.substring(0, lastSlash + 1) } regards manikanta
-
hi, I have a problem with this code. if you understand this please send me the explantion. I dont understand the variable intialization. could u please tell me what it means. var openImage = "
" function getPath(url) { lastSlash = url.lastIndexOf("/") return url.substring(0, lastSlash + 1) } regards manikanta
-
Assuming url contains something like
"dir/subdir/filename"
then you will get the following:openImage = // so putting them together will create the string
I must get a clever new signature for 2011.
var openImage = "<IMG SRC=\"" + getPath(location.href) + "dg"
var closeImage = ".gif\" HEIGHT=21 WIDTH=16>"function getPath(url)
{
lastSlash = url.lastIndexOf("/")
return url.substring(0, lastSlash + 1)
}The code uses location.href, so I think it's looking for a file name dg.gif in the same folder as the web-page being referenced.
Richard MacCutchan wrote:
I think (assuming my page is 'http://mywebdomain/myfolder/mypage.html') this would be:
<IMG SRC="http://mywebdomain/myfolder/dg.gif" HEIGHT=21 WIDTH=16>
"It was when I found out I could make mistakes that I knew I was on to something." -Ornette Coleman "Philosophy is a study that lets us be unhappy more intelligently." -Anon.
-
var openImage = "<IMG SRC=\"" + getPath(location.href) + "dg"
var closeImage = ".gif\" HEIGHT=21 WIDTH=16>"function getPath(url)
{
lastSlash = url.lastIndexOf("/")
return url.substring(0, lastSlash + 1)
}The code uses location.href, so I think it's looking for a file name dg.gif in the same folder as the web-page being referenced.
Richard MacCutchan wrote:
I think (assuming my page is 'http://mywebdomain/myfolder/mypage.html') this would be:
<IMG SRC="http://mywebdomain/myfolder/dg.gif" HEIGHT=21 WIDTH=16>
"It was when I found out I could make mistakes that I knew I was on to something." -Ornette Coleman "Philosophy is a study that lets us be unhappy more intelligently." -Anon.